using Autofac;
using Autofac.Core;
using Autofac.Integration.Mvc;
using Nop.Core.Caching;
using Nop.Core.Infrastructure;
using Nop.Core.Infrastructure.DependencyManagement;
using Nop.Web.CDN.Services;
using Nop.Services.Media;
using Nop.Web.CDN.Controllers;

namespace Nop.Web.CDN.Infrastructure
{
    public class DependencyRegistrar : IDependencyRegistrar
    {
        public virtual void Register(ContainerBuilder builder, ITypeFinder typeFinder)
        {
            //we cache presentation models between requests
            builder.RegisterType<PictureController>()
                .WithParameter(ResolvedParameter.ForNamed<ICacheManager>("nop_cache_static"));
            builder.RegisterType<PictureCDNService>().As<IPictureService>().InstancePerLifetimeScope();
 
        }

        public int Order
        {
            get { return 2; }
        }
    }
}
